Zeit, erfassen: A CLI Activity & Time Tracker

Zeit is a command line activity & time tracker written in Go, focused on simplicity and integrability. It is available on macOS, Linux, FreeBSD, NetBSD, OpenBSD & Plan9.

Zeit, erfassen: A CLI Activity & Time Tracker

Background

For the past couple of years I’ve been happily using Tyme as my main activity & time tracker. I jumped on the Tyme-train on the very first version of the app and following its development up to its current (third) major iteration.

While Tyme itself hasn’t changed much over the past years, its price model did. With the latest update, the developer(s?) changed from a one time payment per major version release to a subscription-based model. Even though I think there can be legitimate reasons for a software product to opt-in on a subscription model, for Tyme and many other apps I feel like the value doesn’t really show.

Don’t get me wrong, Tyme is a great tool. Even though advancements in features don’t really happen that often, one can see that the developer is dedicating significant effort on keeping Tyme up to date. Even left aside the questionable pricing model, it has become increasingly frustrating to work with Tyme in a broader, more sophisticated scope. For example, Tyme basically can’t generate invoices from tracked times by itself. However, there is a plugin for a software called Grand Total, which costs additional money and seemingly integrates with Tyme. After testing that software for a while it turned out to be a huge PITA to use for me and definitely nothing that integrates well into any serious accounting infrastructure.

Besides, there seems to be no way at all to integrate into Tyme, since it does not have any publicly available and documented API/RPC interface to query the the data one feeds into it.

With an increasing frustration over my data being locked-in to a proprietary app that only allows dumb manual exports and additionally costs money on a monthly basis, I decided to try building a replacement for Tyme. In the end, maybe I’d find out that rolling my own tracker is rather too much effort and that it’s worth paying $5 a month in order to not have to do that.

Requirements

There are only a handful of things that I need in a time tracker:

  • An open database that can be read/written programmatically from other tools, either through a dedicated interface (e.g. API) or simply by accessing it directly
  • An absurdly simple interface without too much left-and-right, so that I can start and stop tracking with as few clicks/key presses as possible
  • The ability to adjust tracked entries in order to correct notes/times
  • Reliable recording of activities with crash tolerance (e.g. not losing data from the program or my whole machine dying in the middle of tracking)
  • Some integrability into the my other tools ecosystem
  • A way to backup the database

Everything else is really just a cherry on top:

  • A nice UI? Well, I prefer the CLI/TUI anyway.
  • An iOS app? It can be useful, when on the run and not able to access the computer but still needing to track things. However, not having an iOS app is not a deal-breaker either.
  • Rates and travel expenses? Thanks, but no. While Tyme does that, I never found it to be even close to a good accounting tool. Besides, my accounting pipeline is a set of CLI tools that allow me to export a Tyme JSON file and generate invoices based on purely the hours tracked in Tyme, with rates and other numbers coming from data sources that I’m in full control of.

Why not <insert name here>?

Coming from an existing tool it’s a hard to make the switch to a completely different one – especially when there are other tools involved that rely on specific data formats. Unfortunately, neither Timewarrior nor Watson or any other tool I’ve found did allow for a way to import my Tyme entries. Also, since the rest of my infrastructure is currently still based on Tyme’s JSON format, an export of data in that format is also a requirement in order to not have to rebuild every other internal tool that processes this data. At least not right now.

Another reason is the technology. Most tools I found are built in Ruby, Python or Node.js. While I don’t have any strong preference in terms of programming languages, I wanted a single binary that doesn’t come with plenty of NPM or pip luggage.

Meet zeit

zeit stats

zeit is a command line activity & time tracker written in Go, focused on simplicity and integrability. I chose Go because it’s the most portable, single-binary stack with an immensely powerful standard library and – unlike Rust – allows me to actually get stuff done.

zeit uses BuntDB as a storage engine, which is somewhat abstracted by its own Database struct. It wouldn’t be much effort to replace BuntDB with something else in case it’ll become a liability anytime soon.
For time management zeit makes use of Go’s time package as well as of the now toolkit. Hours are handled as Decimal type and cobra is being used as CLI framework.

zeit can display some nice statistics using the color package; All of the TUI output was manually implemented, without the use of tcell, tview or anything like that. All stats are based on the tracked data, which in turn are stored as simple JSON objects in an easy to process structure. The zeit database can be access by other applications directly, as it is only being locked during write actions (e.g. starting a new activity, finishing a running one, …) and zeit also offers an export command that allows filtering and exporting data in different formats.

There are a few nice tricks zeit can already do and a few more to come. One of these is the automatic git log import.

Using the command zeit task --git <path-to-repo> <task-name> a Git repository can be attached to a task. When tracking time on the task, zeit automatically imports the Git commit messages that were submitted during that period and adds them to the activity notes. This way, tracked times automatically include commit hashes and messages from Git.

I’m looking forward to extend zeit to feature a few more tricks like this, as well as further formats for import and export of data. However, the basic tracking functionality is already in place.

zeit is available as pre-built binaries for macOS, Linux, FreeBSD, NetBSD, OpenBSD and Plan9 and the latest builds can be downloaded here.

zeit on GitHub

Enjoyed this? Support me via Monero, Bitcoin, Lightning, or Ethereum!  More info.